package com.engine.salary.mapper.datacollection;

import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.hrm.DeptInfo;
import com.engine.salary.entity.hrm.JobCallInfo;
import com.engine.salary.entity.hrm.PositionInfo;
import com.engine.salary.entity.hrm.SubCompanyInfo;
import com.engine.salary.entity.hrm.dto.HrmInfoDTO;
import com.engine.salary.entity.hrm.param.HrmQueryParam;
import com.engine.salary.entity.salarysob.param.SalarySobRangeEmpQueryParam;
import org.apache.ibatis.annotations.Param;

import java.util.Collection;
import java.util.List;


public interface EmployMapper {

    /**
     * 只查人力资源表
     * @return
     */
    List<DataCollectionEmployee> listAll();

    /**
     * 获取所有员工，关联部门
     *
     * @return
     */
    List<DataCollectionEmployee> listEmployee();

    /**
     * 单表查询
     * @param ids
     * @return
     */
    List<DataCollectionEmployee> getEmployeeByIds(@Param("collection") List<Long> ids);

    /**
     * 单表查询 包括次账号
     * @param ids
     * @return
     */
    List<DataCollectionEmployee> getEmployeeByIdsIncludeAccountType(@Param("collection") List<Long> ids);

    /**
     * 多表联查
     * @param ids
     * @return
     */
    List<DataCollectionEmployee> getEmployeeByIdsAll(@Param("collection") List<Long> ids);


    /**
     * 根据薪资账套的人员范围转换而成的查询参数查询人员
     *
     * @param queryParams 薪资账套的人员范围转换而成的查询参数
     * @return
     */
    List<DataCollectionEmployee> listByParams(@Param("params") Collection<SalarySobRangeEmpQueryParam> queryParams);

    List<DataCollectionEmployee> listByVirtualParams(@Param("params") Collection<SalarySobRangeEmpQueryParam> queryParams);


    /**
     * 多表，详细信息
     * @param employeeId
     * @return
     */
    DataCollectionEmployee getEmployeeById(Long employeeId);

    /**
     * 报表专用
     * @return
     */
    List<DataCollectionEmployee> listAllForReport();

    /**
     * 所以岗位
     * @param ids
     * @return
     */
    List<PositionInfo> listPositionInfo(@Param("collection") List<Long> ids);

    /**
     * 所以岗位id 获取岗位信息
     * @param id
     * @return
     */
    PositionInfo getPositionInfoById(@Param("positionId") Long id);

    /**
     * 所以部门
     * @param departmentIds
     * @return
     */
    List<DeptInfo> getDeptInfoList(@Param("departmentIds") List<Long> departmentIds);


    /**
     * 虚拟部门（其他组织维度）
     * @param virtualDepartmentIds
     * @return
     */
    List<DeptInfo> getVirtualDeptInfoList(@Param("virtualDepartmentIds") List<Long> virtualDepartmentIds);


    /**
     * 所以分部
     * @param subDepartmentIds
     * @return
     */
    List<SubCompanyInfo> getSubCompanyInfoList(@Param("subDepartmentIds") List<Long> subDepartmentIds);

    /**
     * 根据分部id获取分部信息
     * @param subDepartmentId
     * @return
     */
    SubCompanyInfo getSubCompanyInfoById(@Param("subDepartmentId")Long subDepartmentId);

    /**
     * 虚拟分部
     * @param virtualSubCompanyIds
     * @return
     */
    List<SubCompanyInfo> getVirtualSubCompanyInfoList(@Param("virtualSubCompanyIds") List<Long> virtualSubCompanyIds);


    List<HrmInfoDTO> listHrmInfoByIdAndName(@Param("param") HrmQueryParam param);
    List<HrmInfoDTO> listExtHrmInfoByIdAndName(@Param("param") HrmQueryParam param);


    /**
     * 根据部门名称查询部门
     */
    List<DeptInfo> getDeptInfosByName(String name);

    /**
     * 根据分部名称查询分部
     */
    List<SubCompanyInfo> getSubCompanyInfosByName(String name);

    /**
     * 根据部门id查询部门
     */
    DeptInfo getDeptInfoById(Long id);

    /**
     * 获取大于离职日期的 离职、退休、解聘人员信息
     * @return
     */
    List<DataCollectionEmployee> listByDismissDate(String dismissDate);

    /**
     * 根据虚拟部门获取人员信息
     * @param virtualDepartmentIds
     * @return
     */
    List<DataCollectionEmployee> listVirtualEmpByVirtualDepIds(@Param("virtualDepartmentIds") List<Long> virtualDepartmentIds);

    /**
     * 根据虚拟分部获取人员信息
     * @param virtualSubCompanyIds
     * @return
     */
    List<DataCollectionEmployee> listVirtualEmpByVirtualSubCompanyIds(@Param("virtualSubCompanyIds") List<Long> virtualSubCompanyIds);

    /**
     * 根据分部、部门获取查询
     * @param subCompanyIds
     * @param departmentIds
     * @return
     */
    List<DataCollectionEmployee> listBySubCompanyOrDepartment(@Param("subCompanyIds") List<Long> subCompanyIds, @Param("departmentIds") List<Long> departmentIds);

    JobCallInfo getJobCallInfoById(@Param("jobCallId") Long jobCallId);

    List<Long> listBySubCompany(@Param("subCompanyIds") List<Long> subCompanyIds);

    List<Long> listByDepartment(@Param("departmentIds") List<Long> departmentIds);

    List<Long> listByJob(@Param("jobIds") List<Long> jobIds);
}